//创建一个路由器，并暴露出去

//引入 creatRouter 
import { createRouter, createWebHistory } from 'vue-router'

//引入可能要用到的组件
import Introduction from '@/views/Introduction.vue'
import Show from '@/views/Show.vue'
import Contact from '@/views/Contact.vue'
import Details from '@/views/Details.vue'
import Story from '@/views/Story.vue'

//创建路由器，一个路由器里面有多个路由
const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            name: 'jieshao',
            path: '/intro',
            component: Introduction
        },
        {
            name: 'zhanshi',
            path: '/show',
            component: Show,
            children: [
                {
                    name: 'xiangqing',
                    path: 'details/:id/:title/:content',
                    component: Details,
                    props: true
                }
            ]
        },
        {
            name: 'lianxi',
            path: '/contact',
            component: Contact
        },
        {
            name: 'gushi',
            path: '/story',
            component: Story
        },
        //让指定路径重新定位到另一个路径
        {
            path: '/',
            redirect: '/intro'
        }
    ]
})

export default router